% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/matrix.R
\name{add_to_matrix}
\alias{add_to_matrix}
\title{Add a value to a matrix}
\usage{
add_to_matrix(m, v, by = NULL)
}
\arguments{
\item{m}{A matrix of any type}

\item{v}{Value to be added to \code{m}. No attempt is made to check
if the types match.}

\item{by}{Optional logical matrix or vector indicating which
elements in \code{m} to be modified.}
}
\description{
Simple convenience function that adds a value to a given matrix and
returns the modified matrix.
}
\examples{
x <- matrix(1:9, 3, 3)
y <- matrix(sample(c(TRUE, FALSE), 9, replace = TRUE), 3, 3)

add_to_matrix(x, 2, by = y)

}
